#
# @lc app=leetcode.cn id=121 lang=python3
#
# [121] 买卖股票的最佳时机
#

# @lc code=start
class Solution:
    def maxProfit(self, prices: List[int]) -> int:
        income = 0
        pricesLength = len(prices)
        inPrice = prices[0]
        for i in range(1, pricesLength):
            income = max(prices[i] - inPrice, income)
            inPrice = min(inPrice, prices[i])
        return income
                
# @lc code=end

